import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    params: data
  })
}

export function getInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    params: { token }
  })
}

export function getServerRoute(token) {
  return request({
    url: '/user/getServerRoute',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}

export function selectUserPage(data) {
  return request({
    url: '/user/selectUserPage',
    method: 'get',
    params: data
  })
}

export function insertUser(data) {
  return request({
    url: '/user/insertUser',
    method: 'post',
    params: data
  })
}

export function updateUser(data) {
  return request({
    url: '/user/updateUser',
    method: 'put',
    params: data
  })
}

export function deleteUser(data) {
  return request({
    url: '/user/deleteUser',
    method: 'delete',
    params: data
  })
}

export function validUsername(data) {
  return request({
    url: '/user/validUsername',
    method: 'post',
    params: data
  })
}

export function resetPassword(data) {
  return request({
    url: '/user/resetPassword',
    method: 'put',
    params: data
  })
}
